package org.chispa.api.visitors;

import java.security.NoSuchAlgorithmException;

import javax.crypto.spec.IvParameterSpec;

import org.chispa.api.util.BinningNumber;

public class NumberPVFactory extends AbstractSimpleVisitorFactory<BinningNumber, Long,String> {

	private NumericParamVisitor visitor;

	@Override
	protected SingleParamVisitor<BinningNumber, Long> doCreateVisitor()
			throws NoSuchAlgorithmException {
		if(visitor==null)
			visitor=new NumericParamVisitor(cipher, spec,new IvParameterSpec(ivpar.toByteArray()));
		return visitor;
	}

	@Override
	public SingleParamVisitor<String, String> createVisitorForExpr()
			throws NoSuchAlgorithmException {
		if(visitor==null)
			visitor=new NumericParamVisitor(cipher, spec,new IvParameterSpec(ivpar.toByteArray()));
		return new NumericExpVisitorBridge(visitor);
	}

	
}
